import 'dart:convert' show json;

class ToDayVideo {
  int code;
  String message;
  List<Result> result;

  ToDayVideo.fromParams({this.code, this.message, this.result});

  factory ToDayVideo(jsonStr) => jsonStr == null
      ? null
      : jsonStr is String
          ? new ToDayVideo.fromJson(json.decode(jsonStr))
          : new ToDayVideo.fromJson(jsonStr);

  ToDayVideo.fromJson(jsonRes) {
    code = jsonRes['code'];
    message = jsonRes['message'];
    result = jsonRes['result'] == null ? null : [];

    for (var resultItem in result == null ? [] : jsonRes['result']) {
      result.add(resultItem == null ? null : new Result.fromJson(resultItem));
    }
  }

  @override
  String toString() {
    return '{"code": $code,"message": ${message != null ? '${json.encode(message)}' : 'null'},"result": $result}';
  }
}

class Result {
  String tag;
  int adIndex;
  int id;
  String type;
  Data data;

  Result.fromParams({this.tag, this.adIndex, this.id, this.type, this.data});

  Result.fromJson(jsonRes) {
    tag = jsonRes['tag'];
    adIndex = jsonRes['adIndex'];
    id = jsonRes['id'];
    type = jsonRes['type'];
    data = jsonRes['data'] == null ? null : new Data.fromJson(jsonRes['data']);
  }

  @override
  String toString() {
    return '{"tag": ${tag != null ? '${json.encode(tag)}' : 'null'},"adIndex": $adIndex,"id": $id,"type": ${type != null ? '${json.encode(type)}' : 'null'},"data": $data}';
  }
}

class Data {
  String adTrack;
  String dataType;
  Content content;
  Header header;

  Data.fromParams({this.adTrack, this.dataType, this.content, this.header});

  Data.fromJson(jsonRes) {
    adTrack = jsonRes['adTrack'];
    dataType = jsonRes['dataType'];
    content = jsonRes['content'] == null
        ? null
        : new Content.fromJson(jsonRes['content']);
    header = jsonRes['header'] == null
        ? null
        : new Header.fromJson(jsonRes['header']);
  }

  @override
  String toString() {
    return '{"adTrack": ${adTrack != null ? '${json.encode(adTrack)}' : 'null'},"dataType": ${dataType != null ? '${json.encode(dataType)}' : 'null'},"content": $content,"header": $header}';
  }
}

class Header {
  String cover;
  String font;
  String label;
  String labelList;
  String rightText;
  String subTitle;
  String subTitleFont;
  int id;
  int time;
  bool showHateVideo;
  String actionUrl;
  String description;
  String icon;
  String iconType;
  String textAlign;
  String title;

  Header.fromParams(
      {this.cover,
      this.font,
      this.label,
      this.labelList,
      this.rightText,
      this.subTitle,
      this.subTitleFont,
      this.id,
      this.time,
      this.showHateVideo,
      this.actionUrl,
      this.description,
      this.icon,
      this.iconType,
      this.textAlign,
      this.title});

  Header.fromJson(jsonRes) {
    cover = jsonRes['cover'];
    font = jsonRes['font'];
    label = jsonRes['label'];
    labelList = jsonRes['labelList'];
    rightText = jsonRes['rightText'];
    subTitle = jsonRes['subTitle'];
    subTitleFont = jsonRes['subTitleFont'];
    id = jsonRes['id'];
    time = jsonRes['time'];
    showHateVideo = jsonRes['showHateVideo'];
    actionUrl = jsonRes['actionUrl'];
    description = jsonRes['description'];
    icon = jsonRes['icon'];
    iconType = jsonRes['iconType'];
    textAlign = jsonRes['textAlign'];
    title = jsonRes['title'];
  }

  @override
  String toString() {
    return '{"cover": ${cover != null ? '${json.encode(cover)}' : 'null'},"font": ${font != null ? '${json.encode(font)}' : 'null'},"label": ${label != null ? '${json.encode(label)}' : 'null'},"labelList": ${labelList != null ? '${json.encode(labelList)}' : 'null'},"rightText": ${rightText != null ? '${json.encode(rightText)}' : 'null'},"subTitle": ${subTitle != null ? '${json.encode(subTitle)}' : 'null'},"subTitleFont": ${subTitleFont != null ? '${json.encode(subTitleFont)}' : 'null'},"id": $id,"time": $time,"showHateVideo": $showHateVideo,"actionUrl": ${actionUrl != null ? '${json.encode(actionUrl)}' : 'null'},"description": ${description != null ? '${json.encode(description)}' : 'null'},"icon": ${icon != null ? '${json.encode(icon)}' : 'null'},"iconType": ${iconType != null ? '${json.encode(iconType)}' : 'null'},"textAlign": ${textAlign != null ? '${json.encode(textAlign)}' : 'null'},"title": ${title != null ? '${json.encode(title)}' : 'null'}}';
  }
}

class Content {
  String tag;
  int adIndex;
  int id;
  String type;
  ContentData data;

  Content.fromParams({this.tag, this.adIndex, this.id, this.type, this.data});

  Content.fromJson(jsonRes) {
    tag = jsonRes['tag'];
    adIndex = jsonRes['adIndex'];
    id = jsonRes['id'];
    type = jsonRes['type'];
    data = jsonRes['data'] == null
        ? null
        : new ContentData.fromJson(jsonRes['data']);
  }

  @override
  String toString() {
    return '{"tag": ${tag != null ? '${json.encode(tag)}' : 'null'},"adIndex": $adIndex,"id": $id,"type": ${type != null ? '${json.encode(type)}' : 'null'},"data": $data}';
  }
}

class ContentData {
  String adTrack;
  String campaign;
  String descriptionPgc;
  String favoriteAdTrack;
  String label;
  String lastViewTime;
  String playlists;
  String promotion;
  String remark;
  String shareAdTrack;
  String src;
  String thumbPlayUrl;
  String titlePgc;
  String waterMarks;
  String webAdTrack;
  int date;
  int duration;
  int id;
  int idx;
  int releaseTime;
  int searchWeight;
  bool ad;
  bool collected;
  bool ifLimitVideo;
  bool played;
  String category;
  String dataType;
  String description;
  String descriptionEditor;
  String library;
  String playUrl;
  String resourceType;
  String slogan;
  String title;
  String type;
  List<dynamic> labelList;
  List<PlayInfo> playInfo;
  List<dynamic> subtitles;
  List<Tags> tags;
  Author author;
  Consumption consumption;
  Cover cover;
  Provider provider;
  WebUrl webUrl;

  ContentData.fromParams(
      {this.adTrack,
      this.campaign,
      this.descriptionPgc,
      this.favoriteAdTrack,
      this.label,
      this.lastViewTime,
      this.playlists,
      this.promotion,
      this.remark,
      this.shareAdTrack,
      this.src,
      this.thumbPlayUrl,
      this.titlePgc,
      this.waterMarks,
      this.webAdTrack,
      this.date,
      this.duration,
      this.id,
      this.idx,
      this.releaseTime,
      this.searchWeight,
      this.ad,
      this.collected,
      this.ifLimitVideo,
      this.played,
      this.category,
      this.dataType,
      this.description,
      this.descriptionEditor,
      this.library,
      this.playUrl,
      this.resourceType,
      this.slogan,
      this.title,
      this.type,
      this.labelList,
      this.playInfo,
      this.subtitles,
      this.tags,
      this.author,
      this.consumption,
      this.cover,
      this.provider,
      this.webUrl});

  ContentData.fromJson(jsonRes) {
    adTrack = jsonRes['adTrack'];
    campaign = jsonRes['campaign'];
    descriptionPgc = jsonRes['descriptionPgc'];
    favoriteAdTrack = jsonRes['favoriteAdTrack'];
    label = jsonRes['label'];
    lastViewTime = jsonRes['lastViewTime'];
    playlists = jsonRes['playlists'];
    promotion = jsonRes['promotion'];
    remark = jsonRes['remark'];
    shareAdTrack = jsonRes['shareAdTrack'];
    src = jsonRes['src'];
    thumbPlayUrl = jsonRes['thumbPlayUrl'];
    titlePgc = jsonRes['titlePgc'];
    waterMarks = jsonRes['waterMarks'];
    webAdTrack = jsonRes['webAdTrack'];
    date = jsonRes['date'];
    duration = jsonRes['duration'];
    id = jsonRes['id'];
    idx = jsonRes['idx'];
    releaseTime = jsonRes['releaseTime'];
    searchWeight = jsonRes['searchWeight'];
    ad = jsonRes['ad'];
    collected = jsonRes['collected'];
    ifLimitVideo = jsonRes['ifLimitVideo'];
    played = jsonRes['played'];
    category = jsonRes['category'];
    dataType = jsonRes['dataType'];
    description = jsonRes['description'];
    descriptionEditor = jsonRes['descriptionEditor'];
    library = jsonRes['library'];
    playUrl = jsonRes['playUrl'];
    resourceType = jsonRes['resourceType'];
    slogan = jsonRes['slogan'];
    title = jsonRes['title'];
    type = jsonRes['type'];
    labelList = jsonRes['labelList'] == null ? null : [];

    for (var labelListItem in labelList == null ? [] : jsonRes['labelList']) {
      labelList.add(labelListItem);
    }

    playInfo = jsonRes['playInfo'] == null ? null : [];

    for (var playInfoItem in playInfo == null ? [] : jsonRes['playInfo']) {
      playInfo.add(
          playInfoItem == null ? null : new PlayInfo.fromJson(playInfoItem));
    }

    subtitles = jsonRes['subtitles'] == null ? null : [];

    for (var subtitlesItem in subtitles == null ? [] : jsonRes['subtitles']) {
      subtitles.add(subtitlesItem);
    }

    tags = jsonRes['tags'] == null ? null : [];

    for (var tagsItem in tags == null ? [] : jsonRes['tags']) {
      tags.add(tagsItem == null ? null : new Tags.fromJson(tagsItem));
    }

    author = jsonRes['author'] == null
        ? null
        : new Author.fromJson(jsonRes['author']);
    consumption = jsonRes['consumption'] == null
        ? null
        : new Consumption.fromJson(jsonRes['consumption']);
    cover =
        jsonRes['cover'] == null ? null : new Cover.fromJson(jsonRes['cover']);
    provider = jsonRes['provider'] == null
        ? null
        : new Provider.fromJson(jsonRes['provider']);
    webUrl = jsonRes['webUrl'] == null
        ? null
        : new WebUrl.fromJson(jsonRes['webUrl']);
  }

  @override
  String toString() {
    return '{"adTrack": ${adTrack != null ? '${json.encode(adTrack)}' : 'null'},"campaign": ${campaign != null ? '${json.encode(campaign)}' : 'null'},"descriptionPgc": ${descriptionPgc != null ? '${json.encode(descriptionPgc)}' : 'null'},"favoriteAdTrack": ${favoriteAdTrack != null ? '${json.encode(favoriteAdTrack)}' : 'null'},"label": ${label != null ? '${json.encode(label)}' : 'null'},"lastViewTime": ${lastViewTime != null ? '${json.encode(lastViewTime)}' : 'null'},"playlists": ${playlists != null ? '${json.encode(playlists)}' : 'null'},"promotion": ${promotion != null ? '${json.encode(promotion)}' : 'null'},"remark": ${remark != null ? '${json.encode(remark)}' : 'null'},"shareAdTrack": ${shareAdTrack != null ? '${json.encode(shareAdTrack)}' : 'null'},"src": ${src != null ? '${json.encode(src)}' : 'null'},"thumbPlayUrl": ${thumbPlayUrl != null ? '${json.encode(thumbPlayUrl)}' : 'null'},"titlePgc": ${titlePgc != null ? '${json.encode(titlePgc)}' : 'null'},"waterMarks": ${waterMarks != null ? '${json.encode(waterMarks)}' : 'null'},"webAdTrack": ${webAdTrack != null ? '${json.encode(webAdTrack)}' : 'null'},"date": $date,"duration": $duration,"id": $id,"idx": $idx,"releaseTime": $releaseTime,"searchWeight": $searchWeight,"ad": $ad,"collected": $collected,"ifLimitVideo": $ifLimitVideo,"played": $played,"category": ${category != null ? '${json.encode(category)}' : 'null'},"dataType": ${dataType != null ? '${json.encode(dataType)}' : 'null'},"description": ${description != null ? '${json.encode(description)}' : 'null'},"descriptionEditor": ${descriptionEditor != null ? '${json.encode(descriptionEditor)}' : 'null'},"library": ${library != null ? '${json.encode(library)}' : 'null'},"playUrl": ${playUrl != null ? '${json.encode(playUrl)}' : 'null'},"resourceType": ${resourceType != null ? '${json.encode(resourceType)}' : 'null'},"slogan": ${slogan != null ? '${json.encode(slogan)}' : 'null'},"title": ${title != null ? '${json.encode(title)}' : 'null'},"type": ${type != null ? '${json.encode(type)}' : 'null'},"labelList": $labelList,"playInfo": $playInfo,"subtitles": $subtitles,"tags": $tags,"author": $author,"consumption": $consumption,"cover": $cover,"provider": $provider,"webUrl": $webUrl}';
  }
}

class WebUrl {
  String forWeibo;
  String raw;

  WebUrl.fromParams({this.forWeibo, this.raw});

  WebUrl.fromJson(jsonRes) {
    forWeibo = jsonRes['forWeibo'];
    raw = jsonRes['raw'];
  }

  @override
  String toString() {
    return '{"forWeibo": ${forWeibo != null ? '${json.encode(forWeibo)}' : 'null'},"raw": ${raw != null ? '${json.encode(raw)}' : 'null'}}';
  }
}

class Provider {
  String alias;
  String icon;
  String name;

  Provider.fromParams({this.alias, this.icon, this.name});

  Provider.fromJson(jsonRes) {
    alias = jsonRes['alias'];
    icon = jsonRes['icon'];
    name = jsonRes['name'];
  }

  @override
  String toString() {
    return '{"alias": ${alias != null ? '${json.encode(alias)}' : 'null'},"icon": ${icon != null ? '${json.encode(icon)}' : 'null'},"name": ${name != null ? '${json.encode(name)}' : 'null'}}';
  }
}

class Cover {
  String sharing;
  String blurred;
  String detail;
  String feed;
  String homepage;

  Cover.fromParams(
      {this.sharing, this.blurred, this.detail, this.feed, this.homepage});

  Cover.fromJson(jsonRes) {
    sharing = jsonRes['sharing'];
    blurred = jsonRes['blurred'];
    detail = jsonRes['detail'];
    feed = jsonRes['feed'];
    homepage = jsonRes['homepage'];
  }

  @override
  String toString() {
    return '{"sharing": ${sharing != null ? '${json.encode(sharing)}' : 'null'},"blurred": ${blurred != null ? '${json.encode(blurred)}' : 'null'},"detail": ${detail != null ? '${json.encode(detail)}' : 'null'},"feed": ${feed != null ? '${json.encode(feed)}' : 'null'},"homepage": ${homepage != null ? '${json.encode(homepage)}' : 'null'}}';
  }
}

class Consumption {
  int collectionCount;
  int replyCount;
  int shareCount;

  Consumption.fromParams(
      {this.collectionCount, this.replyCount, this.shareCount});

  Consumption.fromJson(jsonRes) {
    collectionCount = jsonRes['collectionCount'];
    replyCount = jsonRes['replyCount'];
    shareCount = jsonRes['shareCount'];
  }

  @override
  String toString() {
    return '{"collectionCount": $collectionCount,"replyCount": $replyCount,"shareCount": $shareCount}';
  }
}

class Author {
  String adTrack;
  int approvedNotReadyVideoCount;
  int id;
  int latestReleaseTime;
  int recSort;
  int videoNum;
  bool expert;
  bool ifPgc;
  String description;
  String icon;
  String link;
  String name;
  Follow follow;
  Shield shield;

  Author.fromParams(
      {this.adTrack,
      this.approvedNotReadyVideoCount,
      this.id,
      this.latestReleaseTime,
      this.recSort,
      this.videoNum,
      this.expert,
      this.ifPgc,
      this.description,
      this.icon,
      this.link,
      this.name,
      this.follow,
      this.shield});

  Author.fromJson(jsonRes) {
    adTrack = jsonRes['adTrack'];
    approvedNotReadyVideoCount = jsonRes['approvedNotReadyVideoCount'];
    id = jsonRes['id'];
    latestReleaseTime = jsonRes['latestReleaseTime'];
    recSort = jsonRes['recSort'];
    videoNum = jsonRes['videoNum'];
    expert = jsonRes['expert'];
    ifPgc = jsonRes['ifPgc'];
    description = jsonRes['description'];
    icon = jsonRes['icon'];
    link = jsonRes['link'];
    name = jsonRes['name'];
    follow = jsonRes['follow'] == null
        ? null
        : new Follow.fromJson(jsonRes['follow']);
    shield = jsonRes['shield'] == null
        ? null
        : new Shield.fromJson(jsonRes['shield']);
  }

  @override
  String toString() {
    return '{"adTrack": ${adTrack != null ? '${json.encode(adTrack)}' : 'null'},"approvedNotReadyVideoCount": $approvedNotReadyVideoCount,"id": $id,"latestReleaseTime": $latestReleaseTime,"recSort": $recSort,"videoNum": $videoNum,"expert": $expert,"ifPgc": $ifPgc,"description": ${description != null ? '${json.encode(description)}' : 'null'},"icon": ${icon != null ? '${json.encode(icon)}' : 'null'},"link": ${link != null ? '${json.encode(link)}' : 'null'},"name": ${name != null ? '${json.encode(name)}' : 'null'},"follow": $follow,"shield": $shield}';
  }
}

class Shield {
  int itemId;
  bool shielded;
  String itemType;

  Shield.fromParams({this.itemId, this.shielded, this.itemType});

  Shield.fromJson(jsonRes) {
    itemId = jsonRes['itemId'];
    shielded = jsonRes['shielded'];
    itemType = jsonRes['itemType'];
  }

  @override
  String toString() {
    return '{"itemId": $itemId,"shielded": $shielded,"itemType": ${itemType != null ? '${json.encode(itemType)}' : 'null'}}';
  }
}

class Follow {
  int itemId;
  bool followed;
  String itemType;

  Follow.fromParams({this.itemId, this.followed, this.itemType});

  Follow.fromJson(jsonRes) {
    itemId = jsonRes['itemId'];
    followed = jsonRes['followed'];
    itemType = jsonRes['itemType'];
  }

  @override
  String toString() {
    return '{"itemId": $itemId,"followed": $followed,"itemType": ${itemType != null ? '${json.encode(itemType)}' : 'null'}}';
  }
}

class Tags {
  String adTrack;
  String childTagIdList;
  String childTagList;
  int communityIndex;
  int id;
  String actionUrl;
  String bgPicture;
  String desc;
  String headerImage;
  String name;
  String tagRecType;

  Tags.fromParams(
      {this.adTrack,
      this.childTagIdList,
      this.childTagList,
      this.communityIndex,
      this.id,
      this.actionUrl,
      this.bgPicture,
      this.desc,
      this.headerImage,
      this.name,
      this.tagRecType});

  Tags.fromJson(jsonRes) {
    adTrack = jsonRes['adTrack'];
    childTagIdList = jsonRes['childTagIdList'];
    childTagList = jsonRes['childTagList'];
    communityIndex = jsonRes['communityIndex'];
    id = jsonRes['id'];
    actionUrl = jsonRes['actionUrl'];
    bgPicture = jsonRes['bgPicture'];
    desc = jsonRes['desc'];
    headerImage = jsonRes['headerImage'];
    name = jsonRes['name'];
    tagRecType = jsonRes['tagRecType'];
  }

  @override
  String toString() {
    return '{"adTrack": ${adTrack != null ? '${json.encode(adTrack)}' : 'null'},"childTagIdList": ${childTagIdList != null ? '${json.encode(childTagIdList)}' : 'null'},"childTagList": ${childTagList != null ? '${json.encode(childTagList)}' : 'null'},"communityIndex": $communityIndex,"id": $id,"actionUrl": ${actionUrl != null ? '${json.encode(actionUrl)}' : 'null'},"bgPicture": ${bgPicture != null ? '${json.encode(bgPicture)}' : 'null'},"desc": ${desc != null ? '${json.encode(desc)}' : 'null'},"headerImage": ${headerImage != null ? '${json.encode(headerImage)}' : 'null'},"name": ${name != null ? '${json.encode(name)}' : 'null'},"tagRecType": ${tagRecType != null ? '${json.encode(tagRecType)}' : 'null'}}';
  }
}

class PlayInfo {
  int height;
  int width;
  String name;
  String type;
  String url;
  List<UrlList> urlList;

  PlayInfo.fromParams(
      {this.height, this.width, this.name, this.type, this.url, this.urlList});

  PlayInfo.fromJson(jsonRes) {
    height = jsonRes['height'];
    width = jsonRes['width'];
    name = jsonRes['name'];
    type = jsonRes['type'];
    url = jsonRes['url'];
    urlList = jsonRes['urlList'] == null ? null : [];

    for (var urlListItem in urlList == null ? [] : jsonRes['urlList']) {
      urlList
          .add(urlListItem == null ? null : new UrlList.fromJson(urlListItem));
    }
  }

  @override
  String toString() {
    return '{"height": $height,"width": $width,"name": ${name != null ? '${json.encode(name)}' : 'null'},"type": ${type != null ? '${json.encode(type)}' : 'null'},"url": ${url != null ? '${json.encode(url)}' : 'null'},"urlList": $urlList}';
  }
}

class UrlList {
  int size;
  String name;
  String url;

  UrlList.fromParams({this.size, this.name, this.url});

  UrlList.fromJson(jsonRes) {
    size = jsonRes['size'];
    name = jsonRes['name'];
    url = jsonRes['url'];
  }

  @override
  String toString() {
    return '{"size": $size,"name": ${name != null ? '${json.encode(name)}' : 'null'},"url": ${url != null ? '${json.encode(url)}' : 'null'}}';
  }
}
